﻿-var table = ViewData["DataTable"] as DataTable
=HTMLHelper.HiddenInput("tablecontroller",ViewData["Controller"])
=HTMLHelper.HiddenInput("tableaction",ViewData["Action"])
%table.data{width="100%",border="1"}
  %tr
    -foreach(DataColumn c in table.Columns)
      %th{id=c.ColumnName, name=c.ColumnName, title=c.Caption, class="nowrap small"}
        =c.Caption
  -bool odd = true
  -foreach(DataRow r in table.Rows)
    -odd = !odd
    %tr{class=odd?"odd":""}
      -foreach(DataColumn c in table.Columns)
        %td=r[c].ToString()
  -if(ViewData.ContainsKey("total"))
    -var total = ViewData["total"] as Dictionary<string,decimal>
    %tr.total
      -foreach(var k in total.Keys)
        %td          
          -if(total[k] != -1)
            =total[k]